package com.leedsoft.generated;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class Users implements Serializable {
    private Long id;

    private String username;

    private String password;

    private Integer enabled;

    private static final long serialVersionUID = 1L;

    private Map<String, Boolean> selectiveColumns = new HashMap<String, Boolean>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username == null ? null : username.trim();
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password == null ? null : password.trim();
    }

    public Integer getEnabled() {
        return enabled;
    }

    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }

    public boolean isSelective() {
        return this.selectiveColumns.size() > 0;
    }

    public boolean isSelective(String column) {
        return this.selectiveColumns.get(column) != null;
    }

    public Users selective(Column ... columns) {
        this.selectiveColumns.clear();
        if (columns != null) {
            for (Column column : columns) {
                this.selectiveColumns.put(column.value(), true);
            }
        }
        return this;
    }

    public enum Column {
        id("id"),
        username("username"),
        password("password"),
        enabled("enabled");

        private final String column;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        Column(String column) {
            this.column = column;
        }

        public String desc() {
            return this.column + " DESC";
        }

        public String asc() {
            return this.column + " ASC";
        }
    }
}